namespace practiceCourse3 { 
  function removeElement(nums: number[], val: number): number {
    let len = nums.length
    for (let i = 0; i < len; i++) {
      if (nums[i] === val) {
        for (let j = i + 1; j < len; j++) {
          nums[j - 1] = nums[j]
        }
        i--
        len--
      }
    }
    return len
  }
}